package sing.core.util

import android.app.NotificationManager
import android.content.Context
import android.os.Build
import androidx.core.app.NotificationManagerCompat

object PermissionUtil {
    /**
     * 检查通知权限是否打开
     */
    fun isNotificationsOpen(context: Context): Boolean {
        return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            NotificationManagerCompat.from(context).importance != NotificationManager.IMPORTANCE_NONE
        } else NotificationManagerCompat.from(context).areNotificationsEnabled()
    }
}